NAND flash memory, as well as other types of non-volatile memories (“NVMs”), are commonly used in electronic devices for mass storage. For example, consumer electronics such as portable media players often include flash memory to store music, videos, and other media.
Some non-volatile memories, however, are configured such that a block of programmed memory locations needs to be erased before any of the memory locations in the block can be reprogrammed. Therefore, electronic devices typically perform an operation referred to as “garbage collection” (“GC”) to free up blocks for erasing and reprogramming. In particular, a block may include both data that is needed by the electronic device (i.e., “valid data” or “current data”) and data that is no longer needed by the electronic device (i.e., “invalid data” or “obsolete data”). To free up all of the memory locations in that block for erasing, the electronic device may copy the block's valid data into memory locations of another block.
An electronic device typically begins garbage collection when the electronic device runs low on erased blocks. Garbage collection may be a time-consuming process, causing the electronic device to be tied up for a substantial amount of time until a sufficient number of blocks are freed and erased. This may be frustrating for the user, who may want to use the electronic device's processing resources to perform other activities.